import os
from building import *

cwd = GetCurrentDir()

Import('asenv')
BOARD = asenv['BOARD']
MODULES = asenv['MODULES']

objs = []

if('COMMONXML' in MODULES):
    objs += Glob('*.xml')
    objs += Glob('*.arxml')

if(('LWIP' in MODULES) and ('RTTHREAD' not in MODULES)):
    objs += Glob('config/lwip.xml')

if('LIN' in MODULES):
    objs += Glob('config/Lin_*.c')

if('LINIF' in MODULES):
    objs += Glob('config/LinIf_*.c')

if('LINSIF' in MODULES):
    objs += Glob('config/LinSIf_*.c')

if('LINSTP' in MODULES):
    objs += Glob('config/LinSTp_*.c')

if('LINTP' in MODULES):
    objs += Glob('config/LinTp_*.c')

if('LINSM' in MODULES):
    objs += Glob('config/LinSM*.c')

if('CANNM' in MODULES):
    objs += Glob('config/CanNm*.c')

if('CANSM' in MODULES):
    objs += Glob('config/CanSM*.c')

if('COMM' in MODULES):
    objs += Glob('config/ComM*.c')

if('DEM' in MODULES):
    objs += Glob('config/Dem*.c')

if('ECUM' in MODULES):
    objs += Glob('config/EcuM*.c')

if('NM' in MODULES):
    objs += Glob('config/Nm*.c')

if('OSEKNM' in MODULES):
    objs += Glob('config/OsekNm*.c')
    objs += Glob('config/config.xml')

if('PCI' in MODULES):
    objs += Glob('config/pci*.c')

if('RPMSG' in MODULES):
    objs += Glob('config/RPmsg*.c')
    objs += Glob('config/Rproc*.c')
    objs += Glob('config/VirQ*.c')

if('SOAD' in MODULES):
    objs += Glob('config/SoAd*.c')

if('SD' in MODULES):
    objs += Glob('config/SD*.c')

if('RTE' in MODULES):
    objs += Glob('rte/*.c')
    objs += Glob('rte/*.xml')

if('TEST' in MODULES):
    objs += Glob('test/*.c')
    objs += Glob('test/*.xml')
    asenv.Append(CPPPATH=['%s/test'%(cwd)])

if('FDT' in MODULES):
    objs += Glob('config/as.dts')

asenv.Append(CPPPATH=['%s/config'%(cwd)])

Return('objs')
